package receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import application.UIApplication;

/**
 * Created by yanglei on 16/12/12.
 */
public abstract class SignalrConnReceiver extends BroadcastReceiver {
    public static final String Action = UIApplication.PackageName+".Receiver.SignalrConnHandle";
    @Override
    public void onReceive(Context context, Intent intent) {
        if (Action.equals(intent.getAction())){
            String action = intent.getStringExtra("action");
            if(action.equalsIgnoreCase("conn")){
                SignalrConnHandle(context,intent);
            }
            else{
                SignalrStopHandle(context, intent);
            }

        }
    }

    /**
     * signalr连接处理
     * @param context
     * @param intent
     */
    public abstract void SignalrConnHandle(Context context, Intent intent);
    /**
     * signalr重新连接处理
     * @param context
     * @param intent
     */
    public abstract void SignalrStopHandle(Context context, Intent intent);
}
